package org.microservice.common.config;


import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.microservice.common.util.AuthUtil;
import org.microservice.common.util.constant.CommonConstant;
import org.springframework.beans.factory.annotation.Configurable;

/**
 * Created with IntelliJ IDEA.
 * User: 齐丹枫
 * Date: 2018/7/20
 * Time: 10:18
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Configurable
public class FeignConfig implements RequestInterceptor {


    @Override
    public void apply(RequestTemplate requestTemplate) {
        String tokenValue = AuthUtil.getTokenValue();
        requestTemplate.header(CommonConstant.REQ_HEADER,CommonConstant.TOKEN_SPLIT+ tokenValue);
    }
}